const express = require('express');
const bodyParser = require('body-parser');
//挂载路由
const userRouter = require('./route/user');

const app = express();
app.listen(3000);

app.use(bodyParser.urlencoded({
    extended: false
}));

app.use(bodyParser.json());

app.use('/v1/users', userRouter);

//错误处理
app.use((err, req, res, next) => {
    console.log(err);
    res.send({
        code: 500,
        message: '服务端内部错误'
    });
})